<template>
    <div>
        <el-table
                :data="orderData"
                height="450"
                style="width: 100%">
            <el-table-column
                    prop="name"
                    label="电影名"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="number"
                    label="订单编号"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="price"
                    label="单价"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="status"
                    label="状态"
                    width="180">
            </el-table-column>
            <el-table-column
                    label="操作"
                    width="120">
                <template slot-scope="scope">
                    <el-button  @click="handleClick(scope.row.id)" type="success" size="small">出票</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    export default {
        name: "Admin",
        data(){
            return{
                orderData:"",
            }
        },mounted() {
            this.init();
        },methods:{
            init(){
                console.log(11111111);
                this.axios.get("mo/order/findAll").then(
                    r => {
                        this.orderData = r.data;
                    }
                )
            },
            handleClick(id){
                // console.log(id)
                let formData = new FormData();
                formData.append("id",id);
                this.axios.put("mo/order/updateStatus",formData).then(
                    r => {
                        if (r.data == "ok"){
                            this.$message.success("出票成功")
                        }else if (r.data == "no"){
                            this.$message.error("出票失败")
                        }
                        this.init()
                    }
                )

            }
        }
    }
</script>

<style scoped>

</style>